package com.party.admin.web.controller.datacount;

import com.party.admin.biz.datacount.DataCountBizService;
import com.party.admin.web.controller.activity.ActivityController;
import com.party.admin.web.dto.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 数据统计控制器
 * Created by wei.li.
 *
 * @date 2017/12/20 0020
 * @time 17:38
 */

@Controller
@RequestMapping(value = "data/count")
public class DataCountController {

    protected static Logger logger = LoggerFactory.getLogger(DataCountController.class);

    @Autowired
    private DataCountBizService dataCountBizService;

    /**
     * 数据统计初始化
     * @return 交互数据
     */
    @ResponseBody
    @RequestMapping(value = "init")
    public AjaxResult init(){
        AjaxResult ajaxResult = new AjaxResult(true);
        try {
            dataCountBizService.init();
        } catch (Exception e) {
            logger.error("数据统计初始化异常", e);
            ajaxResult.setSuccess(false);
            ajaxResult.setDescription("数据统计初始化异常");
            return ajaxResult;
        }
        return ajaxResult;
    }
}
